﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Buy2Site.Enums;
using Buy2Site.UserControls;

namespace Buy2Site.MasterPages
{
    public partial class MySiteMaster : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public bool LogInVisible 
        {
            set
            {
                this.LogInControl1.Visible = value;
            }
        }
        public bool HelloUserVisible 
        {
            set
            {
                this.LoggedInUserAdvertise1.Visible = value;
            }
        }
        public string PageTitle 
        {
            get
            {
                return this.lblPageTitle.Text;
            }
            set
            {
                this.lblPageTitle.Text = value;
            }
            
        }

        public void HideLink(LinksEnum links)
        {
            LinksEnum link = links;
            //SideBar SideBar1 = (SideBar)this.Master.Master.FindControl("SideBar1");
            
            switch (link)
            {
                case LinksEnum.HomeLink:
                    SideBar1.MainLink.Enabled = false;
                    SideBar1.AboutLink.Enabled = true;
                    SideBar1.RegisterLink.Enabled = true;
                    SideBar1.ShppingCartLink.Enabled = true;
                    SideBar1.PublishItemLink.Enabled = true;
                    break;
                case LinksEnum.AboutLink:
                    SideBar1.MainLink.Enabled = true;
                    SideBar1.AboutLink.Enabled = false;
                    SideBar1.RegisterLink.Enabled = true;
                    SideBar1.ShppingCartLink.Enabled = true;
                    SideBar1.PublishItemLink.Enabled = true;
                    break;
                case LinksEnum.RegisterLink:
                    SideBar1.MainLink.Enabled = true;
                    SideBar1.AboutLink.Enabled = true;
                    SideBar1.RegisterLink.Enabled = false;
                    SideBar1.ShppingCartLink.Enabled = true;
                    SideBar1.PublishItemLink.Enabled = true;
                    break;
                case LinksEnum.ShoppingCartLink:
                    SideBar1.MainLink.Enabled = true;
                    SideBar1.AboutLink.Enabled = true;
                    SideBar1.RegisterLink.Enabled = true;
                    SideBar1.ShppingCartLink.Enabled = false;
                    SideBar1.PublishItemLink.Enabled = true;
                    break;
                case LinksEnum.PublishItemLink:                    
                    SideBar1.MainLink.Enabled = true;
                    SideBar1.AboutLink.Enabled = true;
                    SideBar1.RegisterLink.Enabled = true;
                    SideBar1.ShppingCartLink.Enabled = true;
                    SideBar1.PublishItemLink.Enabled = false;
                    break;
                default:
                    SideBar1.MainLink.Enabled = true;
                    SideBar1.AboutLink.Enabled = true;
                    SideBar1.RegisterLink.Enabled = true;
                    SideBar1.ShppingCartLink.Enabled = true;
                    SideBar1.PublishItemLink.Enabled = true;
                    break;
            }
        }
    }
}